/**
 * @file filter_engine.h
 * @brief An interface contains basic filter functions.
 */
#pragma once

#include "filters/types.h"
#include "core/packet.h"

#include <vector>
#include <atomic>

class IFilterEngine {
public:
    virtual ~IFilterEngine() = default;


    /// Rules control.
    virtual bool addRule(const FilterRule& rule) = 0;
    virtual bool removeRule(uint32_t ruleId) = 0;
    virtual bool updateRule(const FilterRule& rule) = 0;

    /// Batch operation rules.
    virtual void setRules(const std::vector<FilterRule>& rules) = 0;
    virtual std::vector<FilterRule> getRules() const = 0;

    /// Packet process.
    virtual FilterResult processPacket(const Packet& packet) = 0;

    /// Statistics and monitor.
    virtual FilterStats getStatistics() const = 0;
    virtual void resetStatistics() = 0;

    /// Enable / disable filter.
    virtual void enable() = 0;
    virtual void disable() = 0;
    virtual bool isEnabled() const = 0;

    /// Default actions.
    virtual void setDefaultAction(FilterAction action) = 0;
    virtual FilterAction getDefaultAction() const = 0;
};